home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / obsolete / movie.pro < prev    next >
Text File  |  1997-07-08  |  3KB  |  96 lines

  1. ; $Id: movie.pro,v 1.2 1997/01/15 04:02:19 ali Exp $
  2. ;
  3. ; Copyright (c) 1988-1997, Research Systems, Inc.  All rights reserved.
  4. ;       Unauthorized reproduction prohibited.
  5.  
  6. pro movie, images, rate, order = order    ;Image is an (n,m,k) images to show as fast
  7.                 ;as we can.  !Order is set to 1 and restored.
  8. ;+
  9. ; NAME:
  10. ;    MOVIE
  11. ;
  12. ; PURPOSE:
  13. ;    Show a cyclic sequence of images stored in a 3D array.
  14. ;
  15. ; CATEGORY:
  16. ;    Image display.
  17. ;
  18. ; CALLING SEQUENCE:
  19. ;    MOVIE, Images [, Rate]
  20. ;
  21. ; INPUTS:
  22. ;      Images:    A 3D (n, m, nframes) byte array of image data, consisting of
  23. ;        nframes images, each of size n by m.  This array should be
  24. ;        stored with the top row first, (order = 1) for maximum 
  25. ;        efficiency.
  26. ;
  27. ; OPTIONAL INPUT PARAMETERS:
  28. ;    Rate:    Initial animation rate, in APPROXIMATE frames per second.  If 
  29. ;        omitted, the inter-frame delay is set to 0.01 second.
  30. ;
  31. ; KEYWORD PARAMETERS:
  32. ;    ORDER:    The ordering of images in the array.  Set Order to 0 for 
  33. ;        images ordered bottom up, or 1 for images ordered top down 
  34. ;        (the default).
  35. ;
  36. ; OUTPUTS:
  37. ;    No explicit outputs.
  38. ;
  39. ; COMMON BLOCKS:
  40. ;    None.
  41. ;
  42. ; SIDE EFFECTS:
  43. ;    The animation is displayed in the lower left corner of the currently
  44. ;    selected window.
  45. ;
  46. ; RESTRICTIONS:
  47. ;    SunView:
  48. ;    As SunView has no zoom or pan, we have to write each image to
  49. ;    the display.  This restricts the maximum animation rate.  Experience 
  50. ;    has shown that you can count on a rate of approximately 10 
  51. ;    frames per second with 192 by 192-byte images.  This speed varies 
  52. ;    according to the type of computer, amount of physical memory, and 
  53. ;    number of frames in the array.
  54. ;
  55. ;    The amount of available memory also restricts the maximum amount
  56. ;    of data    that can be displayed in  a loop.
  57. ;
  58. ;    X Windows users (Motif and OPEN LOOK) should use the XINTERANIMATE 
  59. ;    routine from the Widget Library for better results.
  60. ;
  61. ; PROCEDURE:
  62. ;    Straightforward.
  63. ;
  64. ; MODIFICATION HISTORY:
  65. ;    DMS, Nov, 1988.
  66. ;-
  67. on_error,2                      ;Return to caller if an error occurs
  68. old_order = !order
  69. s = size(images)
  70. if n_elements(rate) ne 0 then delay = 1./rate else delay = 0.01
  71. if s(0) ne 3 then message, "Images must be a 3d array."
  72.  
  73.         ;Default order is top down cause its faster.
  74. if n_elements(order) ne 0 then !order = order else !order = 1
  75.  
  76. print,"S for slower, F for faster, Q to quit."
  77. i = 0
  78. while 1 do case strupcase(get_kbrd(0)) of
  79. '':    begin
  80.         tv,images(*,*,i)
  81.         wait,delay
  82.         i = i + 1
  83.         if i eq s(3) then i = 0
  84.     endcase
  85. 'S':    delay = delay * 1.5
  86. 'F':    delay = delay / 1.5
  87. 'Q':    begin
  88.     !order=old_order        ;Restore order.
  89.     return
  90.     endcase
  91. else:
  92.  
  93. endcase
  94. end
  95.  
  96.